using Avalonia;
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;

namespace torch.plugin_sample;

public partial class PluginDemo : UserControl
{
    
    public PluginDemo()
    {
        InitializeComponent();
    }

    private void Button_OnClick(object? sender, RoutedEventArgs e)
    {
        var progress = this.FindControl<ProgressBar>("Progress");
        if (progress == null)
        {
            return;
        }
        
        int newValue = (int)(progress.Value + 1);
        if (newValue > 100)
        {
            newValue = 0;
        }
        progress.Value = newValue;
    }
}